package com.hl.toolkit.server.tycoin.account.slaveservice;

import com.tycoin.account.slaveentity.TycoinAccountPayment;
import com.tycoin.account.slaverepository.TycoinAccountPaymentRepository;
import com.tycoin.common.bean.PageInfo;
import com.tycoin.common.entity.Page;
import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.common.service.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(value = "slaveTransactionManager", readOnly = true)
public class TycoinAccountPaymentService   extends AbstractService<TycoinAccountPayment, Long> {

	@Autowired
	private TycoinAccountPaymentRepository tycoinAccountPaymentRepository;
	
	
	@Override
	public AbstractRepository<TycoinAccountPayment, Long> getRepository() {
  		return tycoinAccountPaymentRepository;
	}
 

	public List<TycoinAccountPayment> queryByPage(Page page, Map<String, String> parMap) {
		
		PageInfo pageInfo =new PageInfo();
		Long userId=Long.valueOf(parMap.get("userId"));
		pageInfo.setSize(Integer.valueOf(parMap.get("startIndex")));
		pageInfo.setPage(Integer.valueOf(parMap.get("MaxNum")));
   
		org.springframework.data.domain.Page<TycoinAccountPayment> pageList = tycoinAccountPaymentRepository.queryByPage(userId, pageInfo.getPageRequest());
		return pageList.getContent();
	}

	
	
 	
	public TycoinAccountPayment findOneBypaymentId(String paymentId){
  		return tycoinAccountPaymentRepository.findOneBypaymentId(paymentId);
	}
 
	

}
